<?php
//Turn on error reporting
ini_set('display_errors', 'On');
 
$db = new mysqli('oniddb.cws.oregonstate.edu','eatonkh-db','E7fsixh38qmvlT51','eatonkh-db');
 
//shows errors if are some
if($db->connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
}
 
$barD = isset($_POST['barData']) ? $_POST['barData'] : '';
 
$sql = "insert into barcodeData (barData) values ('$barD');";
 
if(!$result = $db->query($sql)){
    die('There was an error running the query [' . $db->error . ']');
}
 
$db->close();
?>